<?php defined('SYSPATH') or die('No direct script access.');
/**
 * $Id: topics.php 50 2008-07-27 09:06:29Z geertdd $
 *
 * @package    PianissiBoard
 * @author     Geert De Deckere
 */
class Topics_Controller extends Pianissibase_Controller {

	/**
	 * URL: /pianissiboard[/page/{number}]
	 * PianissiBoard homepage. List of all topics.
	 */
	public function index()
	{
		$this->template->pagetitle = 'All Topics';
		$this->template->content = new View('pianissiboard/topics');

		// Pagination setup
		$pagination = new Pagination(array
		(
			'group'       => 'topics',
			'total_items' => $this->topic->count(),
		));

		// Load topics and pagination into template
		$this->template->content->pagination = $pagination;
		$this->template->content->topics = $this->topic->get(array
		(
			'limit'  => $pagination->items_per_page,
			'offset' => $pagination->sql_offset
		));
	}

}